<?php

$userid         = get_loggedin_userid();
$rating_id      = get_input('rating_id');
$comment        = get_input('comment');

$comment_id = add_comment_rating($rating_id, $userid, $comment);

if($comment_id) {
    $rid = get_interest_rating_history($rating_id);
    $receiver_id = $rid->user_id;
    add_opinions_stream($userid, $receiver_id, $rating_id, '1', 'no', '');	
    echo json_encode(export_result(200, array('Added comment')));
} else {
    echo json_encode(export_result(400, array('Error')));
}

?>